'use strict';

module.exports = app => {
  const { STRING, INTEGER } = app.Sequelize;

  const User = app.model.define('user', {
    // 会自动创建主键id 及 创建时间和更新时间
    userName: {
      type: STRING,
      unique: true,
      allowNull: false,
      comment: '用户名 唯一',
    },
    password: {
      type: STRING,
      allowNull: false,
      comment: '密码',
    },
    nickName: {
      type: STRING,
      comment: '昵称',
    },
    gender: {
      type: INTEGER,
      allowNull: false,
      defaultValue: 3,
      comment: '性别(1->男 2->女  3->保密)',
    },
    // 头像
    avatar: {
      type: STRING,
      comment: '头像，图片地址',
    },
    city: {
      type: STRING,
      allowNull: false,
      defaultValue: '秦皇岛',
      comment: '城市',
    },
  });

  return User;
};
